package Vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Vproducto extends javax.swing.JFrame {
	private JPanel panContenedorp;
	private JButton btnregistrar;
	private JTextField txtnombre;
	private JLabel lbltitulo;
	private JButton btnsalir;
	private JTextField txtprecio;
	private JLabel lblprecio;
	private JLabel lblnombre;
	private JTextField tctxcod_producto;
	private JLabel lblcod_producto;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Vproducto inst = new Vproducto();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public Vproducto() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panContenedorp = new JPanel();
				getContentPane().add(panContenedorp, BorderLayout.CENTER);
				panContenedorp.setLayout(null);
				{
					lblcod_producto = new JLabel();
					panContenedorp.add(lblcod_producto);
					lblcod_producto.setText("Código de Producto");
					lblcod_producto.setBounds(52, 76, 124, 15);
				}
				{
					tctxcod_producto = new JTextField();
					panContenedorp.add(tctxcod_producto);
					tctxcod_producto.setBounds(194, 73, 81, 22);
				}
				{
					lblnombre = new JLabel();
					panContenedorp.add(lblnombre);
					lblnombre.setText("Nombre:");
					lblnombre.setBounds(52, 112, 53, 15);
				}
				{
					lblprecio = new JLabel();
					panContenedorp.add(lblprecio);
					lblprecio.setText("Precio:");
					lblprecio.setBounds(52, 152, 43, 15);
				}
				{
					txtprecio = new JTextField();
					panContenedorp.add(txtprecio);
					txtprecio.setBounds(194, 149, 81, 22);
				}
				{
					btnregistrar = new JButton();
					panContenedorp.add(btnregistrar);
					btnregistrar.setText("Registrar");
					btnregistrar.setBounds(95, 219, 89, 32);
				}
				{
					btnsalir = new JButton();
					panContenedorp.add(btnsalir);
					btnsalir.setText("Salir");
					btnsalir.setBounds(213, 218, 89, 33);
				}
				{
					lbltitulo = new JLabel();
					panContenedorp.add(lbltitulo);
					lbltitulo.setText("Productos");
					lbltitulo.setBounds(168, 19, 64, 15);
				}
				{
					txtnombre = new JTextField();
					panContenedorp.add(txtnombre);
					txtnombre.setBounds(194, 109, 81, 22);
				}
			}
			pack();
			this.setSize(455, 347);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	

	public String getNombre() {
		return txtnombre.getText();
	}

	public String getPrecio() {
		return txtprecio.getText();
	}

	
	public String getCodProducto() {
		return tctxcod_producto.getText();
	}

	
	public void agregarListener(ActionListener actionListener) {
		btnregistrar.addActionListener(actionListener);
		btnsalir.addActionListener(actionListener);
		
	}

	
	public void blanquearCampos() {
		tctxcod_producto.setText("");
		txtprecio.setText("");
		txtnombre.setText("");
		
	}	
	
}
